package com.yq.socket1.day1.practice.test1;

import javax.sound.midi.Soundbank;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;


/**
 * @author 3307235355@qq.com
 * @description 客户端键盘录入，服务器端输出文本文件
 * @since 2022/07/01 13:57
 */
public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 8888);
        Scanner scanner = new Scanner(System.in);

        OutputStream out = socket.getOutputStream();
        while (true) {
            System.out.println("键盘录入：");
            String s = scanner.nextLine();
            if ("end".equals(s)) {
                break;
            }
            out.write(s.getBytes());
        }

        socket.close();
    }
}
